import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerPositionExperienceApi {
  /** 任职经历信息信息 */
  export interface PositionExperience {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    workUnit: string; // 工作单位
    startDate: string | Dayjs; // 开始时间
    endDate: string | Dayjs; // 结束时间
    positionName: string; // 职务名称
    positionLevel: string; // 职务层次
    identityType: string; // 身份类别
    isLeader: number; // 是否领导（1：是，0：否）
    teachingSubject: string; // 任教学科
    status: number; // 是否有效（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询任职经历信息分页 */
export function getPositionExperiencePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerPositionExperienceApi.PositionExperience>>('/per/position-experience/page', data,{ desensitize,encrypt });
}

/** 查询任职经历信息详情 */
export function getPositionExperience(id: number) {
  return requestClient.get<PerPositionExperienceApi.PositionExperience>(`/per/position-experience/get?id=${id}`);
}

/** 新增任职经历信息 */
export function createPositionExperience(data: PerPositionExperienceApi.PositionExperience) {
  return requestClient.post('/per/position-experience/create', data);
}

/** 修改任职经历信息 */
export function updatePositionExperience(data: PerPositionExperienceApi.PositionExperience) {
  return requestClient.put('/per/position-experience/update', data);
}

/** 删除任职经历信息 */
export function deletePositionExperience(id: number) {
  return requestClient.delete(`/per/position-experience/delete?id=${id}`);
}

/** 批量删除任职经历信息 */
export function deletePositionExperienceList(ids: number[]) {
  return requestClient.delete(`/per/position-experience/delete-list?ids=${ids.join(',')}`)
}

/** 导出任职经历信息 */
export function exportPositionExperience(params: any) {
  return requestClient.download('/per/position-experience/export-excel', { params });
}
